﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Microsoft.Xna.Framework.Media;
using System.IO;
using System.IO.IsolatedStorage;
using GoEasy.Resources;

namespace GoEasy.Screens
{
    public partial class PicturePanoramaDetail : PhoneApplicationPage
    {
        public PicturePanoramaDetail()
        {
            InitializeComponent();
            string PodcastLogoLocation = "";
            init(PodcastLogoLocation);            
        }

        public void init(string PodcastLogoLocation)
        {
            if (Default_Value.CURRENT_IMAGE_CAPTURED != null)
            {
                var image = GetImageFromIsolatedStorage(Default_Value.CURRENT_IMAGE_CAPTURED);
                PicturePanoramaImage.Source = image;
                PicturePanoramaImage.Stretch = Stretch.Fill;
            }
        }
        private BitmapImage GetImageFromIsolatedStorage(string imageName)
        {
            var bimg = new BitmapImage();
            using (var iso = IsolatedStorageFile.GetUserStoreForApplication())
            {
                using (var stream = iso.OpenFile(imageName, FileMode.Open, FileAccess.Read))
                {
                    bimg.SetSource(stream);
                }
            }
            return bimg;
        }
    }
}